package com.woniuxy.exam.controller;

import com.woniuxy.exam.entity.Movies;
import com.woniuxy.exam.service.IMoviesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lzj
 * @since 2023-10-31
 */
@RestController
@RequestMapping("/movies")
public class MoviesController {

    @Autowired
    private IMoviesService moviesService;

    @GetMapping
    @Cacheable(cacheNames = "movie:list")
    public List<Movies> getMovies(){
        List<Movies> list = moviesService.list();
        return list;
    }
}
